from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase = "DBshop010处理退货"
firefox=openBrowser(urlAdmin) #调用函数打开网址
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,'销售管理','退货管理')



rootPath=get_pro_rootpath() #获取项目的绝对路径
filePath=rootPath+r'\public\order3.txt' #拼接文件路径
orderId=readFile(filePath) #读取文件内容
print(orderId)   #打印订单编号
firefox.find_element_by_xpath('//td[text()="%s"]/following-sibling::td[5]/a[1]'% orderId).click()




firefox.find_element_by_xpath('//input[@id="refund_price"]').clear()
firefox.find_element_by_xpath('//input[@id="refund_price"]'). send_keys('2199')
firefox.find_element_by_xpath('//textarea[@id="re_refund_info"]').send_keys('同意')
firefox.find_element_by_xpath('//button[contains(text(),"提交处理结果")]').click()
firefox.get(url)
#点击我的订单
DBshopLogin(firefox,userName,password)
firefox.find_element_by_link_text('我的订单').click()
firefox.find_element_by_link_text('退货申请').click()
#断言
try:
    firefox.find_element_by_xpath('//td[text()="退款成功"]')
    writeLog("%s 测试通过"%testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()


